#include "IRIVIAProject.h"
#include "RIVIAProject.h"

IRIVIAProject* IRIVIAProject::m_pInstance = nullptr;
QMutex IRIVIAProject::m_lockMutex;

IRIVIAProject *IRIVIAProject::getInstance()
{
    if (nullptr == m_pInstance)
    {
        QMutexLocker oLocker(&m_lockMutex);
        {
            if (nullptr == m_pInstance)
            {
                m_pInstance = new RIVIAProject();
            }
        }
    }
    return m_pInstance;
}

void IRIVIAProject::freeInstance()
{
    if (nullptr != m_pInstance)
    {
        QMutexLocker oLocker(&m_lockMutex);
        {
            if (nullptr != m_pInstance)
            {
                RIVIAProject* pPro = dynamic_cast<RIVIAProject*>(m_pInstance);
                delete pPro;
                m_pInstance = nullptr;
            }
        }
    }
}
